package com.psp.park.persist.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.psp.park.model.ParkUserFormRecordBean;
import com.psp.park.persist.dao.ParkUserFormRecordDao;

@Repository
public class ParkUserFormRecordImpl extends BaseImpl implements ParkUserFormRecordDao {

	protected static final String NAME_SPACE = NAME_SPACE_HEADER + ".ParkUserFormRecordMapper";

	@Override
	public int insert(ParkUserFormRecordBean record) {
		return sqlSessionTemplate.insert(NAME_SPACE + ".insert", record);
	}

	@Override
	public int selectCount(String puid, int type) {
		Map<String, Object> where = new HashMap<String, Object>();
		where.put("puid", puid);
		where.put("type", type);
		return sqlSessionTemplate.selectOne(NAME_SPACE + ".selectCount", where);
	}

	@Override
	public List<ParkUserFormRecordBean> selectList(int page, int pageSize, String puid, int type) {
		Map<String, Object> where = new HashMap<String, Object>();
		where.put("start", page * pageSize);
		where.put("length", pageSize);
		where.put("puid", puid);
		where.put("type", type);
		return sqlSessionTemplate.selectList(NAME_SPACE + ".selectList", where);
	}

}
